export default {
  namespaced: true,

  state: () => ({
    // 消息数量
    message: JSON.parse(uni.getStorageSync('message') || '[]')
  }),

  mutations: {
    updateMessageInfo(state, message) {
      state.message = message
      this.commit('m_message/saveMessageInfoToStorage')
    },
    saveMessageInfoToStorage(state) {
      uni.setStorageSync('message', JSON.stringify(state.message))
    },
  },

  getters: {
   // 未读消息数量
   total(state) {
     return state.message.count;
   },
  }
}
